import 'package:silver_flutter/model/tag.dart';

class Book {
  final int id;
  final String title;
  final String author;
  final String description;
  final String coverImageUrl;
  final List<Tag> tags;
  final bool complete;

  Book(
      {this.id,
      this.title,
      this.author,
      this.description,
      this.coverImageUrl,
      this.tags,
      this.complete});

  factory Book.fromJson(Map<String, dynamic> json) {
    return new Book(
        id: json['id'],
        title: json['title'],
        author: json['author'],
        description: json['description'],
        coverImageUrl: json['coverImageUrl'],
        tags: (json['tags'] as List).map((e) => new Tag.fromJson(e)).toList(),
        complete: json['complete']);
  }
}
